package P1424;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int weekDay = sc.nextInt(),day = sc.nextInt(),sum = 0;
        for (int i = 0; i < day; ++i){
            if (weekDay>7) weekDay %= 7;
            if (weekDay< 6) sum += 250;
            weekDay ++;
        }
        System.out.println(sum);
    }
}
